package oocl.com.filter.impl;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import oocl.com.filter.DataFilter;
import oocl.com.util.RegexUtil;

public class DataFilterImpl implements DataFilter {

	@Override
	public boolean dataFilter(String input) {
		if(input == null)
			return false;
		String[] buf = input.split(":");
		if(buf.length != 4)
			return false;
		for(String i:buf){
			if(i == null)
				return false;
		}
		
		String regex = "\\d{4}/\\d{2}/\\d{2}";
		if(!RegexUtil.checkData(regex, buf[2]))
			return false;
		
		regex = "^\\d+(\\.\\d+|\\d+)";
		if(!RegexUtil.checkData(regex, buf[1]))
			return false;
		
		regex = "[0|1]";
		if(!RegexUtil.checkData(regex, buf[3]))
			return false;
		
		return true;
	}

}
